package init

import (
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
	"user-srv/basic/config"
)

func InitEs() {
	var err error
	cfg := elasticsearch.Config{
		Addresses: []string{
			"http://" + fmt.Sprintf("%s:%d", config.AppConf.Es.Host, config.AppConf.Es.Port),
		},
		// ...
	}
	config.Els, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic(err)
	} else {
		fmt.Println("Es init success")
	}
}
